package com.tlw.practice.tlw.config;

import com.tlw.practice.tlw.interceptors.JWTInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class InterceptorConfig  implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptor())
                // 拦截所有接口
                .addPathPatterns("/**")
                .addPathPatterns("/user/**")
                // 除了用户相关
                .excludePathPatterns("/user/login")
//                .excludePathPatterns("/user/info")
                // 和 swagger
                .excludePathPatterns("/swagger-ui/**")
                .excludePathPatterns("/swagger-resources/**")
                .excludePathPatterns("/profile/**")
                .excludePathPatterns("/v3/**");
    }
}
